{% extends "base.html" %}
{% block css %}
<link rel="stylesheet" href="/static/css/admin.css" />
{% endblock %}

{% block nav %}
   <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container">

        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </a>
        <a class="brand" href="/admin/">Googler Admin</a>
        <div class="nav-collapse">
          <ul class="nav">

            <li class="active"><a href="/admin/">Home</a></li>
            <li><a href="/admin/view_companies">Companies</a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
{% endblock %}
{% block content %}


<form class="form-horizontal" method="POST" action="/admin/manage_playlist">
<fieldset>
  <input type="hidden" name="org_key" value="{{ organization.key }}" />
  <legend>Add playlist group for {{ organization.name }}</legend>
    <div class="control-group">
      <label for="input01" class="control-label">Group or bucket name</label>
      <div class="controls">
        <input type="text" name="group_name" id="input01" class="input-xlarge">
        <p class="help-block">Enter a name for the playlist group. ie UK</p>
      </div>
    </div>
    <div class="control-group">
      <label for="input02" class="control-label">Description</label>
      <div class="controls">
        <input type="text" name="description" id="input01" class="input-xlarge">
        <p class="help-block">Enter a name for this group ie, for UK targeting ads only</p>
      </div>
    </div>

    <div class="form-actions">
     <button class="btn btn-primary" type="submit">Create Playlist Group</button>
    </div>
</fieldset>
</form>
<br /><br /><br />
<h2>Groups already in this organization</h2>
<table class="table table-striped">
  <tr>
    <th>Name</th>
    <th>Description</th>
    <th></th>
  </tr>
  {% for playlist_group in org_playlist %}
  <tr>
    <td>{{ playlist_group.name }}</td>
    <td>{{ playlist_group.description }}</td>
    <td><a href="/admin/associate_ytplaylist?org_key={{organization.key}}&parent_group_id={{playlist_group.id}}">Associate Live YT Playlist to this Group</a></td>
  </tr>
  {% endfor %}
</table>
<!--

{% regroup org_playlist by group_name as playlist_data_list %}
<table class="table table-striped">
<tr>
   <th>Parent Name</th>
   <th>Playlistid</th>
   <th>Playlist Name</th>
</tr>

{% for group_name in playlist_data_list %}
       <tr>
         <td><b>{{ group_name.grouper }}</b></td>
         <td></td>
         <td></td>
       </tr>
       {% for playlist in group_name.list %}
       <tr>
         <td></td>
         <td>{{playlist.playlistid }}</td>
         <td>{{playlist.playlist_name}}</td>
       </tr>
      {% endfor %}
{% endfor %}
</table>
-->
{% endblock %}
